<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!DOCTYPE html>
<html>

    <head>

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <title>Lei's Blog | Posts</title>

        <link href="/static/css/bootstrap.min.css" rel="stylesheet">
        <link href="/static/font-awesome/css/font-awesome.css" rel="stylesheet">
        <link href="/static/css/animate.css" rel="stylesheet">
        <link href="/static/css/style.css" rel="stylesheet">

        <link href="/static/css/plugins/footable/footable.core.css" rel="stylesheet"> 
        <link href="/static/js/plugins/summernote/summernote.css" rel="stylesheet"> 
        <!--<link href="/static/css/plugins/summernote/summernote.css" rel="stylesheet">--> 
        <link href="/static/css/plugins/summernote/summernote-bs3.css" rel="stylesheet"> 

        <script data-main="/static/js/admin-frame.js" src="/static/js/require.min.js"></script>
    </head>

    <body class="white-bg">
        <i id="scriptTag">/static/js/admin/admin-post-edit.js</i>
        <div class="panel panel-primary">
            <div class="panel-heading">
                博文管理
            </div>
            <div class="panel-body">
                <div class="tabs-container">

                    <div class="tab-content">
                        <div id="post-add" class="tab-pane active">
                            <div class="panel-body">
                                <div class="row">
                                    <div class="col-lg-10">
                                        <form class="form-horizontal" id="post-config-form">
                                            <div class="form-group">
                                                <label class="col-lg-2 control-label">标题</label>
                                                <div class="col-lg-10">
                                                    <input type="text" name="post-title" id="post-title" class="form-control" value="<?php echo $post['post_title']; ?>">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-lg-2 control-label">分类</label>
                                                <div class="col-lg-10">
                                                    <select id="post-cat" name="post-cat" class="form-control m-b">
                                                        <option value="" selected>请选择</option>
                                                        <?php foreach ($cats as $item): ?>
                                                            <option value="<?php echo $item['cat_id']; ?>" <?php if ($item['cat_id'] == $post['cat_id']) {
                                                            echo 'selected';
                                                        } ?>>
                                                            <?php echo $item['cat_name']; ?>
                                                            </option>
                                                        <?php endforeach; ?>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-lg-2 control-label">标签</label>
                                                <div class="col-lg-10">
                                                    <?php foreach ($tags as $item): ?>
                                                        <a href="#" class="tag-item btn 
                                                        <?php foreach (explode(',', $post['tag_id']) as $val): ?>
                                                                   <?php if ($item['tag_id'] == $val) {
                                                                       echo ' active';
                                                                   } else {
                                                                       continue;
                                                                   } ?>" 
                                                        <?php endforeach; ?>
                                                           data-id="<?php echo $item['tag_id']; ?>" >
                                                        <?php echo $item['tag_name']; ?>
                                                        </a>
                                                        <?php endforeach; ?>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-lg-2 control-label">内容</label>
                                                <div class="col-lg-10">
                                                    <div id="summernote">
                                                        <?php echo $post['post_content'] ?>	
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <div class="col-lg-offset-2 col-lg-10">
                                                    <button id="post-save-btn" data-id="<?php echo $post['post_id']; ?>" class="btn btn-white" type="button"><i class="fa fa-check text-navy"></i></button>
                                                    <button id="giveup-btn" class="btn btn-white" type="button"><i class="fa fa-times text-danger"></i></button>

                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </body>
</html>



